﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Collections;

public partial class YHGL_CWSD : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!ProjectPrivate.GetQX("11"))
    {
      Server.Transfer("~\\blank.aspx");
    }
    BindGrid();
  }

  protected void BindGrid()
  {
    string sSql = @"select ROW_NUMBER() OVER (ORDER BY rq desc) AS xh,a.RQ,b.XM,(case when a.sdzt=0 then '解锁' else '上锁' end) ZT 
from sys_cwsd a,sys_user b where a.dlm=b.dlm and a.khlx='" + DropDownList1.SelectedValue + "'";
    DataSet ds = DbHelperSQL.Query(sSql);
    ASPxGridView1.DataSource = ds;
    ASPxGridView1.DataBind();
  }
  protected void btnSS_Click(object sender, EventArgs e)
  {
    List<CommandInfo> cis = new List<CommandInfo>();

    ArrayList arrValue = new ArrayList();
    arrValue.Add(DateTime.Now.ToString());
    arrValue.Add(SysManage.Get_User);
    arrValue.Add("1");
    arrValue.Add(DropDownList1.SelectedValue);
    ArrayList arrLengh = new ArrayList();
    arrLengh.Add("20");
    arrLengh.Add("20");
    arrLengh.Add("20");
    arrLengh.Add("20");
    cis.Add(CommonUse.InsertCI("SYS_cwsd", arrValue, arrLengh));

    if (DbHelperSQL.ExecuteSqlTran(cis) > 0)
    {
      lbMessage.Text = "保存成功";
      BindGrid();
    }
  }

  protected void btnJS_Click(object sender, EventArgs e)
  {
    List<CommandInfo> cis = new List<CommandInfo>();

    ArrayList arrValue = new ArrayList();
    arrValue.Add(DateTime.Now.ToString());
    arrValue.Add(SysManage.Get_User);
    arrValue.Add("0");
    arrValue.Add(DropDownList1.SelectedValue);
    ArrayList arrLengh = new ArrayList();
    arrLengh.Add("20");
    arrLengh.Add("20");
    arrLengh.Add("20");
    arrLengh.Add("20");
    cis.Add(CommonUse.InsertCI("SYS_cwsd", arrValue, arrLengh));

    if (DbHelperSQL.ExecuteSqlTran(cis) > 0)
    {
      lbMessage.Text = "保存成功";
      BindGrid();
    }
  }
  protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
  {

  }
}
